﻿using System.Threading.Tasks;
using CRM.Services.Email;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace CRM.Controllers.Email
{
    [Route("api/[controller]")]
    [ApiController]
    public class EmailMarketingLogController : BaseController
    {
        private readonly MyDbContext _dbContext;
        private readonly ILogger<MailjetApplicationService> _logger;
        private readonly EmailMarketingLogService _emailMarketingLogService;

        public EmailMarketingLogController(MyDbContext dbContext, ILogger<MailjetApplicationService> logger,EmailMarketingLogService emailMarketingLogService)
        {
            _dbContext = dbContext;
            _logger = logger;
            _emailMarketingLogService = emailMarketingLogService;
        }

        /// <summary>
        /// 根据营销任务id获取操作记录
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet(nameof(Index))]
        public async Task<ResultStruct> Index([FromQuery] int id)
        {
            var result = await _emailMarketingLogService.GetInfo(id);
            return Success(result);
        }
    }
}